package com.aspose.cells;

class zgv implements zafu {
   private Cells a;
   private RowCollection b;

   zgv(Cells var1, RowCollection var2) {
      this.a = var1;
      this.b = var2;
   }

   public zp a(int var1) {
      Row var2 = this.b.a(var1, true, true, false);
      return var2 == null ? null : var2.a;
   }

   public Row b(int var1) {
      return this.b.a(var1, true, true, false);
   }

   public Cell a(int var1, int var2) {
      return this.b.a(var1, var2, true, true, true);
   }

   public zfv a(int var1, zfv var2, int var3) {
      Row var4 = this.b.a(var1, true, true, false);
      if (var4 == null) {
         return null;
      } else {
         Cell var5 = var4.b.b(var2.a);
         if (var5 != null) {
            var5.b();
            return var5.c;
         } else {
            int var6 = var4.b.d(var2.a);
            return var6 < 0 ? null : var4.a.a(var6, var2, var3);
         }
      }
   }

   public int a() {
      if (this.b.c.a() > 0) {
         zr var1 = this.b.c;
         zahl var2 = var1.a(-1, -1, true);

         while(true) {
            int var3 = var2.a();
            if (var3 < 0) {
               break;
            }

            zp var4 = var1.f(var3);
            if (var4.a() > 0) {
               return var4.h();
            }
         }
      }

      return -1;
   }

   public int a_() {
      if (this.b.c.a() > 0) {
         zr var1 = this.b.c;
         zahl var2 = var1.a(-1, -1, true);

         label23:
         while(true) {
            int var5 = var2.a();
            if (var5 < 0) {
               break;
            }

            zp var4 = var1.f(var5);
            zahl var3 = var4.b();

            do {
               var5 = var3.a();
               if (var5 < 0) {
                  continue label23;
               }
            } while(var4.h(var5) == 0);

            return var4.h();
         }
      }

      return -1;
   }

   public zahr a(int var1, int var2, boolean var3) {
      return new zgv.za(this.a, this.b, var1, var2, var3);
   }

   private class za implements zahr {
      private Cells b;
      private RowCollection c;
      private zr d;
      private zahl e;
      private int f;
      private zp g;
      private Row h;

      za(Cells var2, RowCollection var3, int var4, int var5, boolean var6) {
         this.b = var2;
         this.c = var3;
         this.d = var2.f();
         this.e = this.d.b(var4, var5, var6);
         this.f = this.e == null ? -1 : 0;
      }

      public boolean hasNext() {
         return this.c();
      }

      public Object next() {
         return this.d();
      }

      public void remove() {
         throw new CellsException(19, "Removing cells data while iteration is not supported");
      }

      public int a() {
         return this.f;
      }

      public void b() {
         if (this.e != null) {
            this.e.b();
            this.f = 0;
            this.h = null;
            this.g = null;
         }

      }

      public void a(int var1) {
         if (this.e != null) {
            this.f = 0;
            this.e.b(var1);
            this.h = null;
            this.g = null;
         }

      }

      public boolean c() {
         if (this.f < 0) {
            return false;
         } else {
            this.f = this.e.a();
            this.h = null;
            this.g = null;
            return this.f > -1;
         }
      }

      public Object d() {
         return this.f();
      }

      public zp e() {
         if (this.g == null) {
            this.g = this.d.f(this.f);
         }

         return this.g;
      }

      public Row f() {
         if (this.h == null) {
            this.h = new Row(this.b, this.c, this.e(), false);
         }

         return this.h;
      }

      public void g() {
      }

      public boolean h() {
         return false;
      }

      public void a(int var1, int var2) {
         this.e.a(var1, var2);
      }
   }
}
